<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<!-- remove old header -->


<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>cogen API Reference Documentation
        - Class: Join</title><meta name="MSSmartTagsPreventParsing" content="true" /><meta http-equiv="imagetoolbar" content="no" /><link href="css/default.css" rel="stylesheet" type="text/css" /><link href="css/pygments.css" rel="stylesheet" type="text/css" />
    <!-- <link rel="shortcut icon" href="/images/favicon.ico" type="image/vnd.microsoft.icon"/> -->
    <link rel="stylesheet" href="css/apydia.css" type="text/css" />
    <script src="js/jquery-1.2.1.pack.js" type="text/javascript"></script>
    <script src="js/apydia.js" type="text/javascript"></script>
	<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
</head>
<body>
    <div id="page">
        <div id="browser">
            <div class="browser-section">
                <h2>Module Index</h2>
                <ul>
                    <li>
                        <a href="cogen.html">cogen</a>
                    </li><li>
                        <a href="cogen.common.html">cogen.common</a>
                    </li><li>
                        <a href="cogen.core.html">cogen.core</a>
                    </li><li>
                        <a href="cogen.core.coroutines.html">cogen.core.coroutines</a>
                    </li><li class="active">
                        <a href="cogen.core.events.html">cogen.core.events</a>
                    </li><li>
                        <a href="cogen.core.proactors.html">cogen.core.proactors</a>
                    </li><li>
                        <a href="cogen.core.proactors.base.html">cogen.core.proactors.base</a>
                    </li><li>
                        <a href="cogen.core.proactors.epoll_impl.html">cogen.core.proactors.epoll_impl</a>
                    </li><li>
                        <a href="cogen.core.proactors.poll_impl.html">cogen.core.proactors.poll_impl</a>
                    </li><li>
                        <a href="cogen.core.proactors.select_impl.html">cogen.core.proactors.select_impl</a>
                    </li><li>
                        <a href="cogen.core.pubsub.html">cogen.core.pubsub</a>
                    </li><li>
                        <a href="cogen.core.queue.html">cogen.core.queue</a>
                    </li><li>
                        <a href="cogen.core.schedulers.html">cogen.core.schedulers</a>
                    </li><li>
                        <a href="cogen.core.sockets.html">cogen.core.sockets</a>
                    </li><li>
                        <a href="cogen.core.util.html">cogen.core.util</a>
                    </li><li>
                        <a href="cogen.web.html">cogen.web</a>
                    </li><li>
                        <a href="cogen.web.async.html">cogen.web.async</a>
                    </li><li>
                        <a href="cogen.web.wsgi.html">cogen.web.wsgi</a>
                    </li>
                </ul>
            </div>
            <div class="browser-section">
                <h2>cogen.core.events</h2>
                <ul>
                    <li>
                        <a href="cogen.core.events.AddCoro.html">AddCoro</a>
                    </li><li>
                        <a href="cogen.core.events.ConnectionClosed.html">ConnectionClosed</a>
                    </li><li>
                        <a href="cogen.core.events.ConnectionError.html">ConnectionError</a>
                    </li><li>
                        <a href="cogen.core.events.CoroutineException.html">CoroutineException</a>
                    </li><li class="active">
                        <a href="cogen.core.events.Join.html">Join</a>
                    </li><li>
                        <a href="cogen.core.events.OldCall.html">OldCall</a>
                    </li><li>
                        <a href="cogen.core.events.Operation.html">Operation</a>
                    </li><li>
                        <a href="cogen.core.events.OperationTimeout.html">OperationTimeout</a>
                    </li><li>
                        <a href="cogen.core.events.Signal.html">Signal</a>
                    </li><li>
                        <a href="cogen.core.events.Sleep.html">Sleep</a>
                    </li><li>
                        <a href="cogen.core.events.TimedOperation.html">TimedOperation</a>
                    </li><li>
                        <a href="cogen.core.events.WaitForSignal.html">WaitForSignal</a>
                    </li>
                </ul>
            </div>
            <div class="browser-section">
                <h2>Constructor</h2>
                <ul>
                    <li>
                        <a href="cogen.core.events.Join.html#constructor">__init__</a>
                    </li>
                </ul>
            </div>
            <div class="browser-section">
                <h2>Methods</h2>
                <ul>
                    <li>
                        <a href="cogen.core.events.Join.html#method-cleanup">cleanup</a>
                    </li><li>
                        <a href="cogen.core.sockets.SocketOperation.html#method-finalize">finalize</a>
                    </li><li>
                        <a href="cogen.core.events.Join.html#method-process">process</a>
                    </li><li>
                        <a href="cogen.core.sockets.SocketOperation.html#method-set_timeout">set_timeout</a>
                    </li>
                </ul>
            </div>
            <div class="browser-section">
                <h2>Attributes</h2>
                <ul>
                    <li>
                        <a href="cogen.core.events.Join.html#attribute-coro">coro</a>
                    </li><li>
                        <a href="cogen.core.sockets.SocketOperation.html#attribute-delta">delta</a>
                    </li><li>
                        <a href="cogen.core.sockets.SocketOperation.html#attribute-last_checkpoint">last_checkpoint</a>
                    </li><li>
                        <a href="cogen.core.sockets.SocketOperation.html#attribute-prio">prio</a>
                    </li><li>
                        <a href="cogen.core.sockets.SocketOperation.html#attribute-state">state</a>
                    </li><li>
                        <a href="cogen.core.sockets.SocketOperation.html#attribute-timeout">timeout</a>
                    </li><li>
                        <a href="cogen.core.sockets.SocketOperation.html#attribute-weak_timeout">weak_timeout</a>
                    </li>
                </ul>
            </div>
        </div>
        <div id="content">
    <h1>Class: cogen.core.events.Join</h1>
    <div class="docstring rst"><p>A operation for waiting on a coroutine.</p>
<p>Example:</p>
<div class="source"><pre><span class="nd">@coroutine</span>
<span class="k">def</span> <span class="nf">coro_a</span><span class="p">():</span>
    <span class="n">return_value</span> <span class="o">=</span> <span class="k">yield</span> <span class="n">events</span><span class="o">.</span><span class="n">Join</span><span class="p">(</span><span class="n">ref</span><span class="p">)</span>


<span class="nd">@coroutine</span>
<span class="k">def</span> <span class="nf">coro_b</span><span class="p">():</span>
    <span class="k">yield</span> <span class="s">"bla"</span>
    <span class="k">raise</span> <span class="ne">StopIteration</span><span class="p">(</span><span class="s">"some return value"</span><span class="p">)</span>

<span class="n">ref</span> <span class="o">=</span> <span class="n">scheduler</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">coro_b</span><span class="p">)</span>
<span class="n">scheduler</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">coro_a</span><span class="p">)</span>
</pre></div>
<p>This will pause the coroutine and resume it when the other coroutine
(<cite>ref</cite> in the example) has died.</p>
</div>
    <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk/cogen/core/events.py#399">View source</a>
    </li>
</ul>
    <div>
        <h2>Constructor</h2>
        <h3 id="constructor">
            __init__
            <span class="args">(self, coro, **kws)</span>
        </h3>
        <div class="docstring rst"></div>
        <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
    </div>
    <div>
        <h2>Methods</h2>
            <h3 id="method-cleanup">
                cleanup
                <span class="args">(self, sched, coro)</span>
            </h3>
            <div class="docstring rst"><p>Remove the calling coro from the waiting list.</p>
</div>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
            <h3 id="method-finalize">
                finalize
                <span class="args">(self)</span>
            </h3>
            <div class="docstring rst"><p>Called just before the Coroutine wrapper passes the operation back
in the generator. Return value is the value actualy sent in the
generator. Subclasses might overwrite this method and call it from
the superclass.</p>
</div>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
            <h3 id="method-process">
                process
                <span class="args">(self, sched, coro)</span>
            </h3>
            <div class="docstring rst"><p>Add the calling coroutine as a waiter in the coro we want to join.
Also, doesn't keep the called active (we'll be activated back when the
joined coro dies).</p>
</div>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
            <h3 id="method-set_timeout">
                set_timeout
                <span class="args">(self, val)</span>
            </h3>
            <div class="docstring rst"></div>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
    </div>
    <div>
        <h2>Attributes</h2>
            <h3 id="attribute-coro">coro</h3>
            <div class="docstring rst"></div>
            <h4>Value of coro</h4>
            <pre class="code"><code>&lt;member 'coro' of 'Join' objects&gt;</code></pre>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
            <h3 id="attribute-delta">delta</h3>
            <div class="docstring rst"></div>
            <h4>Value of delta</h4>
            <pre class="code"><code>&lt;member 'delta' of 'TimedOperation' objects&gt;</code></pre>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
            <h3 id="attribute-last_checkpoint">last_checkpoint</h3>
            <div class="docstring rst"></div>
            <h4>Value of last_checkpoint</h4>
            <pre class="code"><code>&lt;member 'last_checkpoint' of 'TimedOperation' objects&gt;</code></pre>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
            <h3 id="attribute-prio">prio</h3>
            <div class="docstring rst"></div>
            <h4>Value of prio</h4>
            <pre class="code"><code>&lt;member 'prio' of 'Operation' objects&gt;</code></pre>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
            <h3 id="attribute-state">state</h3>
            <div class="docstring rst"></div>
            <h4>Value of state</h4>
            <pre class="code"><code>&lt;member 'state' of 'Operation' objects&gt;</code></pre>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
            <h3 id="attribute-timeout">timeout</h3>
            <div class="docstring rst"></div>
            <h4>Value of timeout</h4>
            <pre class="code"><code>&lt;member 'timeout' of 'TimedOperation' objects&gt;</code></pre>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
            <h3 id="attribute-weak_timeout">weak_timeout</h3>
            <div class="docstring rst"></div>
            <h4>Value of weak_timeout</h4>
            <pre class="code"><code>&lt;member 'weak_timeout' of 'TimedOperation' objects&gt;</code></pre>
            <ul class="link-bar">
    <li class="link-to-sourcecode">
        <a href="http://code.google.com/p/cogen/source/browse/trunk#0">View source</a>
    </li>
</ul>
    </div>
        </div>
        <div id="footer">
            Generated with <a href="http://apydia.ematia.de/" class="extern">
            Apydia 0.0.3</a>
        </div>
    </div>
</body>
</html>